import sys

class Solution(object):
    def divide(self, dividend, divisor):
        """
        :type dividend: int
        :type divisor: int
        :rtype: int
        """
        sign = None
        if dividend<0 and divisor>0: sign = -1
        elif dividend>0 and divisor<0: sign = -1
        else: sign = 1

        dividend = abs(dividend)
        divisor = abs(divisor)

        ret = None

        if divisor==0:
            ret = sys.maxsize
        elif dividend>=sys.maxsize:
            ret = sys.maxsize
        elif divisor==1:
            ret = dividend
        elif dividend==divisor:
            ret = 1
        elif dividend<divisor:
            ret = 0
        else:
            exp = 0
            d = divisor
            while (d+d)<=dividend:
                d = d+d
                exp+=1
            ret = (1<<exp) + self.divide(dividend-d, divisor)
        return ret if sign==1 else -ret

print(Solution().divide(1, -1))